package flex.persistence {
	public class FetchType extends AbstractType {
		protected static var localInstantiation:Boolean = false;
		
		private static var _LAZY:FetchType; 
		public static function get LAZY():FetchType {
			if(!_LAZY) { 
				localInstantiation = true;
				_LAZY = new FetchType("LAZY");
				localInstantiation = false;
			}
			return _LAZY;
		} 
		
		private static var _EAGER:FetchType; 
		public static function get EAGER():FetchType {
			if(!_EAGER) { 
				localInstantiation = true;
				_EAGER = new FetchType("EAGER");
				localInstantiation = false;
			}
			return _EAGER;
		} 

		public static function valueOf(name:String):FetchType {
			for each(var val:FetchType in values()) {
				if(val.name.toUpperCase() == name.toUpperCase()) return val;
			}
			return null;
		}
		
		public static function values():Array {
			return [LAZY, EAGER];
		}
		
		public function FetchType(name:String) {
			if(!localInstantiation) throw Error("Private constructor");
			this.name = name;
		}
		
	}
}